﻿<%@ Page Title="Search Trails" Language="C#" EnableEventValidation="false" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Search.aspx.cs" Inherits="UI_Search" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table class="style1" width="99%" border="0" cellpadding="0" cellspacing="0">
        <colgroup align="left" style="padding-left:20px"></colgroup>
        <colgroup align="right"></colgroup>
        <colgroup></colgroup>
        <colgroup align="left" style="padding-left:20px"></colgroup>
        <tr>
            <td class="arial_heading_font" colspan="4">
                &nbsp;</td>
        </tr>
        <tr>
            <td class="arial_heading_font" colspan="2" align="left" style="padding-left:20px">
                Search for Trail title</td>
            <td>
                <asp:TextBox ID="txtTrailTitle" runat="server" CssClass="flieds"></asp:TextBox>
            </td>
            <td class="arial_heading_font" align="left" style="padding-left:20px">
                Enter a trail title or a part of trail title</td>
        </tr>
        <tr>
            <td class="arial_heading_font" colspan="2" align="left" style="padding-left:20px">
                Search for User nickname</td>
            <td>
                <asp:TextBox ID="txtNickname" runat="server" CssClass="flieds"></asp:TextBox>
            </td>
            <td class="arial_heading_font" colspan="2" align="left" style="padding-left:20px">
                Enter a nickname or a part of nickname</td>
        </tr>
        <tr>
            <td class="arial_heading_font" colspan="2" align="left" style="padding-left:20px">
                Search for Trail description</td>
            <td>
                <asp:TextBox ID="txtDescription" runat="server" CssClass="flieds"></asp:TextBox>
            </td>
            <td class="arial_heading_font" align="left" style="padding-left:20px">
                Enter one or more keywords, that are parts of trail description </td>
        </tr>
         <tr>
            <td class="arial_heading_font" align="left" style="padding-left:20px">
                Search for Layer(s)</td>
            <td class="arial_heading_font" align="right"><asp:DropDownList
                 ID="ddlLayers" runat="server" AutoPostBack="True"><%--onselectedindexchanged="ddlLayers_SelectedIndexChanged"--%>
                                    </asp:DropDownList></td>
            <td>
                <asp:TextBox ID="txtLayers" runat="server" CssClass="flieds"></asp:TextBox>
            </td>
            <td class="arial_heading_font" align="left" style="padding-left:20px">
                Enter one or more layers</td>
        </tr>
         <tr>
            <td class="arial_heading_font" colspan="2" align="left" style="padding-left:20px">
                Search for Radius</td>
            <td>
                <asp:TextBox ID="txtRadius" runat="server" CssClass="flieds"></asp:TextBox>
                <asp:RegularExpressionValidator ID="revRadius" runat="server" 
                    ControlToValidate="txtRadius" Display="Dynamic" 
                    ErrorMessage="RegularExpressionValidator" SetFocusOnError="True" 
                    ToolTip="Radius should be a number" ValidationExpression="^[1-9]+[0-9]*$">*</asp:RegularExpressionValidator>
            </td>
            <td class="arial_heading_font" align="left" style="padding-left:20px">
                Enter a search radius in kilometers from actual position on map</td>
        </tr>
        <tr>
            <td align="left" colspan="4">
            <br />
            </td>
        </tr>
        <tr>
            <td colspan="4" align="center"><asp:Button ID="btnSearch" runat="server" 
                    Text="Search" onclick="btnSearch_Click" CssClass="form_btn_big" />
                </td>
        </tr>

        <!-- 
        JUAN: jquery script is loaded in the master page
        -->
        
        <script type="text/javascript">
            function onSelectedIndexChanged() 
            {
                var selectedValue = $('#<%=ddlLayers.ClientID %> option:selected').text();
                if (selectedValue) {
                    var textValue = $('#<%=txtLayers.ClientID %>').val();
                    if (textValue.length == 0)
                        $('#<%=txtLayers.ClientID %>').val(selectedValue);
                    else if (textValue.indexOf(selectedValue, 0) == -1)
                        $('#<%=txtLayers.ClientID %>').val(textValue + ", " + selectedValue);
                }
            }
        </script>
    </table>
</asp:Content>

